fhand = open('mbox.txt', 'r')

name_email_counter = {}
for line in fhand:
    if not line.startswith('From '):
        continue

    words = line.split()
    word = words[1]
    name_email_counter[word] = name_email_counter.get(word, 0) + 1

t = []
for item in name_email_counter.items():
    person, count = item
    t.append((count, person))

t.sort(reverse=True)
if len(t) < 0:
    exit()

count, name = t[0]
print(name, count)
